#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;

class Solution {
public:
    int longestOnes(vector<int>& nums, int k) {
        int left = 0, right = 0;
        int len = nums.size();
        int ret = 0;
        while (right < len)
        {
            if (nums[right] == 0) k--;
            while (left <= right && k < 0)
            {
                if (nums[left] == 0) k++;
                left++;
            }
            ret = max(ret, right - left + 1);
            right++;
        }
        return ret;
    }
};


int main()
{
	return 0;
}
